/** @jsxRuntime automatic */
/** @jsxImportSource ../xml-runtime */
import { filePrefix } from '@/constants'
import { AssetClip } from './AssetClip'

export function Sequence({ pathObject, mediaInfo, clipItems, sequenceInfo }) {
  return (
    <project name={`${filePrefix}${pathObject.name}`}>
      <sequence
        format="r1"
        duration={`${sequenceInfo.frameCount * sequenceInfo.multiple}/${
          sequenceInfo.frameRate * sequenceInfo.multiple
        }s`}
        tcStart="0s"
        tcFormat="NDF"
        // vlevin @ 2022-11-05 FCP无法识别枚举值mono，而且导入单声道之后输出XML也是stereo，所以设为固定值
        // audioLayout={mediaInfo.channelCount === 1 ? 'mono' : 'stereo'}
        audioLayout="stereo"
        // vlevin @ 2022-11-05 48k的性质同上
        // audioRate={mediaInfo.sampleRate}
        audioRate="48k"
      >
        <spine>
          {clipItems.map((item, index) => (
            <AssetClip
              key={index}
              name={pathObject.name}
              frameRate={sequenceInfo.frameRate}
              multiple={sequenceInfo.multiple}
              offset={item.offset}
              start={item.start}
              duration={item.duration}
            ></AssetClip>
          ))}
        </spine>
      </sequence>
    </project>
  )
}
